/**
 * 创元汇 - 全局变量定义
 * http://menger.me
 * @大梦
 */

'use strict';

import { Platform, UIManager } from 'react-native'
import Services from '../utils/utilsRequest'
import Constants from '../constants/Constants'
import StatusCode from '../constants/StatusCode'
import ServicesApi from '../constants/ServicesApi'
import ExitAppManager from '../components/common/ExitAppManager'

/**
 * @开启安卓的布局动画
 */
UIManager.setLayoutAnimationEnabledExperimental && UIManager.setLayoutAnimationEnabledExperimental(true);

/**
 * @屏蔽调试警告
 */
console.ignoredYellowBox = [
    'Module',
    'It looks',
    'Battery state',
    'Require cycle:',
    'Remote debugger is in',
    'Required dispatch_sync',
    'Warning: isMounted(...)',
    'Warning: WebView',
    /**
     * @暂时屏蔽 [后续更新]
     */
    'Warning: Slider',
    'Warning: ViewPagerAndroid',
    'Accessing view manager configs directly off UIManager',
];

/**
 * @屏蔽输出
 */
if (!__DEV__) {
    global.console = {
        info: () => { },
        log: () => { },
        warn: () => { },
        debug: () => { },
        error: () => { }
    };
}

/**
 * @系统是iOS
 */
global.__IOS__ = (Platform.OS === 'ios');
/**
 * @系统是安卓
 */
global.__ANDROID__ = (Platform.OS === 'android');
/**
 * @网络请求
 */
global.Services = new Services();
/**
 * @API
 */
global.ServicesApi = ServicesApi;
/**
 * @状态码
 */
global.StatusCode = StatusCode;
/**
 * @系统常量
 */
global.Constants = Constants;
/**
 * @ExitAppManager
 */
global.ExitAppManager = ExitAppManager;